//
//  FKInformationCell.m
//  WanTao
//
//  Created by Macbook Pro on 2019/3/18.
//  Copyright © 2019 Macbook Pro. All rights reserved.
//

#import "FKInformationCell.h"
#import "FKInformation.h"

@interface FKInformationCell ()

@property (nonatomic, weak) UILabel *titleLabel;
@property (nonatomic, weak) UILabel *bottomLabel;
@property (nonatomic, weak) UIImageView *pictureView;

@end

@implementation FKInformationCell

- (void)setupSubviews
{
    [super setupSubviews];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    UILabel *titleLabel = [UILabel fk_labelWithFont:fk_adjustFont(15) textColor:fkColor333333];
    [self.contentView addSubview:titleLabel];
    self.titleLabel = titleLabel;
    titleLabel.numberOfLines = 2;
    
    UILabel *bottomLabel = [UILabel fk_labelWithFont:fk_adjustFont(12) textColor:fkColor999999];
    [self.contentView addSubview:bottomLabel];
    self.bottomLabel = bottomLabel;
    
    UIImageView *pictureView = [[UIImageView alloc] init];
    [self.contentView addSubview:pictureView];
    self.pictureView = pictureView;
    
    [pictureView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.offset(fk_adjustW(115));
        make.height.offset(fk_adjustW(78));
        make.right.offset(-12);
        make.centerY.offset(0);
    }];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(12);
        make.right.equalTo(pictureView.mas_left).offset(-8);
        make.top.offset(fk_adjustW(25));
    }];
    [bottomLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(titleLabel);
        make.bottom.offset(fk_adjustW(-12));
    }];
}

- (void)setData:(id)data
{
    [super setData:data];
    
    if ([data isKindOfClass:[FKInformation class]]) {
        FKInformation *model = data;
        self.titleLabel.text = model.title;
        self.bottomLabel.text = model.bottomText;
        [self.pictureView sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:kPlaceholder_2x1];
    }
    
}

@end
